
package cn.webrx;

import java.util.Date;

public class Arr2 {
    public static void main(String[] args) {
        //使用数组
        var nn = new int[]{11, 22, 33, 44, 55};
        String[] addr = new String[]{"北京", "上海", "天津", "重庆", "郑州"};
        Date[] ds = new Date[6];

        //输出数组元素
        System.out.println(addr[2]);

        //遍历数组
        for (int i = 0; i < addr.length; i++) {
            System.out.printf("addr[%d] = %s %n", i, addr[i]);
        }

        for (var s : addr) {
            System.out.println(s);
        }

        //数组倒序输出
        for (int i = addr.length - 1; i >= 0; i--) {
            System.out.printf("addr[%d] = %s %n", i, addr[i]);
        }
    }
}
